<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>一周中的第几天</title>
</head>
<body>
  <script>
    function fn(day, month, year) {
      let date = year + '-' + month + '-' + day;
      // 把获取的参数 拼接成日期字符串
      let a = new Date(date).getDay()
      // 用日期对象识别一下这天是星期几 返回的就是下面数组的下标
      let b = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
      return b[a]
    }
    console.log(fn(31, 8, 2019))
  </script>
</body>
</html>